using System;
using System.Collections.Generic;
using Gtk;
using finlasku;

public partial class MainWindow: Gtk.Window
{	

	private IList<Gtk.Bin> _views = new List<Gtk.Bin>();
	private WNewBill newBillView = new WNewBill();
	private WBrowse browseBillsView = new WBrowse(); 
	private WCustomerRegister customerRegistryView = new WCustomerRegister();
	
	public MainWindow (): base (Gtk.WindowType.Toplevel)
	{
		Build ();
		CreateViews();
		
		UusiLaskuAction1.Activate();
	}
	
	private void CreateViews()
	{
		newBillView.WidthRequest = 600;
        newBillView.HeightRequest = 500;
		fixed2.Add(newBillView);
		_views.Add(newBillView);
		
		Gtk.Fixed.FixedChild wChildNewBill = ((Gtk.Fixed.FixedChild)(this.fixed2[this.newBillView]));
		wChildNewBill.X = 125;
        wChildNewBill.Y = 28;
		
		browseBillsView.WidthRequest = 600;
        browseBillsView.HeightRequest = 500;
		fixed2.Add(browseBillsView);
		_views.Add(browseBillsView);
		
		Gtk.Fixed.FixedChild wChildBrowse = ((Gtk.Fixed.FixedChild)(this.fixed2[this.browseBillsView]));
		wChildBrowse.X = 125;
        wChildBrowse.Y = 28;
		
		customerRegistryView.WidthRequest = 600;
        customerRegistryView.HeightRequest = 500;
		fixed2.Add(customerRegistryView);
		_views.Add(customerRegistryView);
		
		Gtk.Fixed.FixedChild wChildCustomers = ((Gtk.Fixed.FixedChild)(this.fixed2[this.customerRegistryView]));
		wChildCustomers.X = 125;
        wChildCustomers.Y = 28;
	}
		
	protected void OnDeleteEvent (object sender, DeleteEventArgs a)
	{
		Application.Quit ();
		a.RetVal = true;
	}

	protected virtual void menuClose (object sender, System.EventArgs e)
	{
		Application.Quit();
	}

	protected virtual void changeView (object o, System.EventArgs args)
	{
		RadioAction action = (RadioAction)o;
		
		Console.WriteLine(action.Name);
		
		for (int i = 0; i < _views.Count; i++)
		{
			if (action.Value == i)
				_views[i].Show();
			else
				_views[i].Hide();
		}
	}


}